<?php
$conf = new DOMDocument(); 
$conf->load( '../../../collector/config/matchers.xml' ); 

$xmlDoc = new DOMDocument();

//create the root element
$applications = $xmlDoc->appendChild(
          $xmlDoc->createElement("applications"));
 
$logs = $conf->getElementsByTagName( "log" ); 
foreach( $logs as $log ) 
{

 
  $apps = $log->getElementsByTagName( "application" ); 
  $app_name = $apps->item(0)->nodeValue;

  $apps = $log->getElementsByTagName( "used_fields" ); 
  $used_fields_name = $apps->item(0)->nodeValue;  


  $application = $applications->appendChild(
					      $xmlDoc->createElement("application"));
				  $application->appendChild(
				    $xmlDoc->createElement("name", $app_name));
 $application->appendChild(
				    $xmlDoc->createElement("value", $used_fields_name));

  }

header("Content-Type: text/xml");
				$xmlDoc->formatOutput = true;
echo $xmlDoc->saveXML(); 
?>
